import { AxiosTransformer } from '../types'
import fn = jest.fn

export default (data: any, headers: any, fns?: AxiosTransformer | AxiosTransformer[]): any => {
  if (!fns) {
    return data
  }
  if (!Array.isArray(fns)) {
    fns = [fns]
  }

  fns.forEach(fn => {
    data = fn(data, headers)
  })
  return data

}
